package com.google.zxing.client.android;
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
 
public class HistoryMainActivity extends Activity{ 
	private LinearLayout table_his;
	ListView lv;
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    	super.onCreate(savedInstanceState);
		setContentView(R.layout.history_view);
		// 获取界面元素
		getViews();
		history();
		// 按钮按下
		setListeners();
	}

	// 获取页面元素对象
	private void getViews() {
		table_his = (LinearLayout) findViewById(R.id.table_history);
	}

	// 按钮按下时监听
	private void setListeners() {
		//btn.setOnClickListener(btnOnClick);
	}
	
	private void history(){
		table_his.removeView(lv);
		/**
		 * 查询
		 */
		// 值		
		List<String> lineMsg=new ArrayList<String>();
		lineMsg.add("1");
		lineMsg.add("2");
		lineMsg.add("3");
		lineMsg.add("4");
		lineMsg.add("5");
		lineMsg.add("6");
		ListAdapter la=new ArrayAdapter<String>(HistoryMainActivity.this,android.R.layout.simple_expandable_list_item_1,lineMsg);
		lv=new ListView(HistoryMainActivity.this);
		lv.setAdapter(la);
		lv.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			//点击单个列响应事件跳转查询二维码
				showInfo(((TextView) view).getText());
			}
		});
		
		table_his.addView(lv);	
	}
	
	public void showInfo(CharSequence text) {
		Toast.makeText(HistoryMainActivity.this, text, Toast.LENGTH_LONG).show();
	}
} 